#!/bin/bash

# 检测系统包管理工具，并安装 python3-pip
if command -v yum &> /dev/null; then
    echo "Detected yum-based system."
    sudo yum install -y epel-release
    sudo yum install -y python3-pip
elif command -v apt-get &> /dev/null; then
    echo "Detected apt-based system."
    sudo apt-get update
    sudo apt-get install -y python3-pip
else
    echo "Unsupported package manager."
    exit 1
fi

# 配置 pip 使用阿里云的 PyPI 源
mkdir -p /root/.pip
cat <<EOF > /root/.pip/pip.conf
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/

[install]
trusted-host = mirrors.aliyun.com
EOF

echo "pip 已配置为使用阿里云的 PyPI 源。"

# 下载并执行命令：curl -sSL https://raw.gitcode.com/Lzcsfg/Shell_Script/raw/main/python/pip-%E9%85%8D%E7%BD%AE%E9%98%BF%E9%87%8C%E6%BA%90.sh | sed 's/\r$//' | bash